
<div class="theme-form">
    <?php echo $this->Form->create( "Theme" ); ?>
    <fieldset>
       <div class="form-group"><?php echo $this->Form->input( "name", array(
                      "label" => "Nume",
                      "class" => "form-control",
                      'value' => $theme['Theme']['name'],
					  "pattern" => "[a-zA-Z0-9 ]{4,}"
                  ) ); ?></div>
        <div class="form-group"><?php echo $this->Form->input( "description", array(
                          "label" => "Descriere Tema",
                          "class" => "form-control",
                          "type"=>"textarea",
                        'value' => $theme['Theme']['description'],
						"pattern" => "[a-zA-Z0-9 ]{10,}"
                      ) ); ?></div>

        <div class="added_requirements">
        <?php
        $i=0;
        foreach($reqs as $req)
            {
            echo '
            <div class="requirement_add_form req'.$req['Requirement']['id'].'"><h1>Cerinta '.($i+1).' <a onclick="DeleteReq('.$req['Requirement']['id'].')">Sterge</a></h1>
                <div class="form-group"><div class="input select"><label for="Requirement'.$i.'Type">Tip</label><select name="data[Requirement'.$i.'][type]" class="form-control" onchange="ReqSelect(this)" id="Requirement'.$i.'Type">
                    <option value="text"'.($req['Requirement']['type']=='text'?' selected="selected"':'').'>Small Text</option>
                    <option value="textarea"'.($req['Requirement']['type']=='textarea'?' selected="selected"':'').'>Text</option>
                    <option value="select"'.($req['Requirement']['type']=='select'?' selected="selected"':'').'>Select</option>
                    <option value="radio"'.($req['Requirement']['type']=='radio'?' selected="selected"':'').'>Radio</option>
                    <option value="checkbox"'.($req['Requirement']['type']=='checkbox'?' selected="selected"':'').'>Check</option>
                </select></div></div>
                <div class="form-group req_hidden"><div class="input text"><label for="Requirement'.$i.'TypeValues">Valori</label><input name="data[Requirement'.$i.'][type_values]" class="form-control" type="text" id="Requirement'.$i.'TypeValues" value="'.$req['Requirement']['type_values'].'"></div></div>
                <div class="form-group"><div class="input checkbox"><label for="Requirement'.$i.'Name">Necesar</label><input name="data[Requirement'.$i.'][required]" class="form-control" type="checkbox" id="Requirement'.$i.'Required"'.($req['Requirement']['required']==1?' checked="checked"':'').'></div></div>
                <div class="form-group"><div class="input text"><label for="Requirement'.$i.'Name">Nume</label><input name="data[Requirement'.$i.'][name]" class="form-control" type="text" id="Requirement'.$i.'Name" value="'.$req['Requirement']['name'].'"></div></div>
                <div class="form-group"><div class="input text"><label for="Requirement'.$i.'Description">Descriere</label><input name="data[Requirement'.$i.'][description]" class="form-control" type="text" id="Requirement'.$i.'Description" value="'.$req['Requirement']['description'].'"></div></div>
            </div>';
            $i++;
            }
        echo '<script>var req_nr='.$i.';</script>';
        ?>

        </div>
        <div class="add_req_button" onclick="AddRequirement()">+ Adauga Cerinta</div>
    <?php echo $this->Form->end( array(
                                             "label" => "Modificare tema",
                                             "class" => "btn"
                                         ) ); ?>

    </fieldset>
</div>

<a href="<?=SITE_URL?>profesor/adaugare_etapa/<?=$theme['Theme']['id']?>" class="link_util" style="width: 100%;">Adaugare Etapa</a>